fix(core): export missing shared types to prevent TS2742 in consumer projects#2586
fix(core): export missing shared types to prevent TS2742 in consumer projects#2586
Conversation
…projects Types like `DataOrientation`, `Direction`, `StringOrNumber`, etc. are used in public component prop interfaces (e.g. `SeparatorProps`, `TabsRootProps`) but were not re-exported from the main `index.ts` entry point. The bundler's chunk splitting placed them in an internal chunk (`index3`), which is not listed in the package `exports` map. This caused TS2742 errors in consumer projects using `vue-tsc` with `declaration: true`: error TS2742: The inferred type of '__VLS_export' cannot be named without a reference to 'reka-ui/dist/index3'. This is likely not portable. Re-exporting these types from `src/index.ts` ensures they are included in the main `index.d.ts` declaration file, making them resolvable without referencing internal chunks.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe package's public type surface is expanded by re-exporting seven additional type definitions ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes downstream TypeScript declaration portability issues (TS2742) by ensuring commonly used shared types referenced by public component prop interfaces are exported from the package’s main entrypoint (packages/core/src/index.ts), preventing consumers from needing to reference tsdown-generated internal declaration chunks.
Changes:
- Re-export shared public-facing types (
DataOrientation,Direction,StringOrNumber, etc.) frompackages/core/src/index.ts. - Ensure these types become part of the main declaration surface rather than ending up in internal, non-exported
dist/index*.d.tschunks.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
commit: |
🔗 Linked issue
N/A (new report)
❓ Type of change
📚 Description
Several shared types (
DataOrientation,Direction,StringOrNumber,FormFieldProps,ScrollBodyOption,SingleOrMultipleProps,SingleOrMultipleType) are used in public component prop interfaces (e.g.SeparatorProps,TabsRootProps,AccordionRootProps,SliderRootProps, etc.) but are not re-exported from the mainsrc/index.tsentry point.During bundling,
tsdown'sadvancedChunksplaces these types in an auto-generated internal chunk (e.g.index3.d.ts), which is not listed in the package'sexportsmap. This causes TS2742 errors in consumer projects that usevue-tscwithdeclaration: true:Affected components include (but are not limited to):
Separator,Tabs,Accordion,Slider,RadioGroup,ToggleGroup,Toolbar,Stepper,ColorSlider,Listbox, and all other components whose props referenceDataOrientation,Direction, orStringOrNumber.Fix: Re-export the missing types from
src/index.tsso they become part of the mainindex.d.tsdeclaration file, making them resolvable without referencing internal chunks.Reproduction
declaration: trueintsconfig.jsonreka-ui@2.9.5<Separator>or<TabsRoot>usingdefineProps<SeparatorProps>()vue-tsc --noEmit→ TS2742 error📝 Checklist
Summary by CodeRabbit